{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "gpuClass": "standard"
  },
  "cells": [
    {
      "cell_type": "code",
      "source": [
        "!pip install -q torch-scatter -f https://data.pyg.org/whl/torch-${TORCH}.html\n",
        "!pip install -q torch-sparse -f https://data.pyg.org/whl/torch-${TORCH}.html\n",
        "!pip install -q git+https://github.com/pyg-team/pytorch_geometric.git"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "GWObtdXPhJbb",
        "outputId": "9002bafe-5368-465d-d9a1-390930edb046"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\u001b[?25l     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/106.8 KB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m106.8/106.8 KB\u001b[0m \u001b[31m3.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25h  Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "  Building wheel for torch-scatter (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m208.2/208.2 KB\u001b[0m \u001b[31m5.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25h  Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "  Building wheel for torch-sparse (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "  Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
            "  Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
            "  Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m280.2/280.2 KB\u001b[0m \u001b[31m6.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25h  Building wheel for torch-geometric (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Dc8zD1JSblU7",
        "outputId": "9d89887a-3174-41cc-8958-7875c7e44aec"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Mounted at /content/drive/\n"
          ]
        }
      ],
      "source": [
        "from google.colab import drive\n",
        "drive.mount('/content/drive/')"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "cd \"/content/drive/MyDrive/Nego_UBAR/CLB\""
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "3z5M4iW3cTUC",
        "outputId": "89dbc284-e65b-4543-8dc9-865fb3e4ee64"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "/content/drive/MyDrive/Nego_UBAR/CLB\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "ls"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "uj-1hECfcteR",
        "outputId": "509e858c-d0f3-4810-c6b2-efb032a06939"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "annotated_user_da_with_span_full.json  \u001b[0m\u001b[01;34mclb-processed\u001b[0m/\n",
            "\u001b[01;34mclb-analysis\u001b[0m/                          CraigListBergain.csv\n",
            "CLB_GAT_act.csv                        data.json\n",
            "CLB_GAT_both.csv                       data.json.zip\n",
            "CLB_GAT_int_act.csv                    glove.6B.300d.txt\n",
            "CLB_GAT_int_both.csv                   mapping.pair\n",
            "CLB_GAT_int_n_strategy.csv             testListFile.json\n",
            "CLB_GAT_n_strategy.csv                 turn_lengths.txt\n",
            "CLB_GAT_single_act.csv                 valListFile.json\n",
            "CLB_gnn.csv\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import pandas as pd\n",
        "pd.set_option('display.max_colwidth', None)\n",
        "import numpy as np\n",
        "import re\n",
        "import matplotlib.pyplot as plt\n",
        "from scipy.stats import kde"
      ],
      "metadata": {
        "id": "1f_dS_Srcu6I"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.preprocessing import LabelEncoder"
      ],
      "metadata": {
        "id": "rL7ZYJO6mnUl"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "from torch_geometric.data import Data\n",
        "from torch_geometric.loader import DataLoader\n",
        "from torch_geometric.nn import GATConv\n",
        "from torch_geometric.datasets import Planetoid\n",
        "import torch_geometric.transforms as T\n",
        "import torch\n",
        "import torch.nn as nn\n",
        "import torch.nn.functional as F"
      ],
      "metadata": {
        "id": "CF8BvAVImpWg"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "clb = pd.read_csv(\"CraigListBergain.csv\")\n",
        "clb.head(10)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 754
        },
        "id": "QwkdV6fVcxQ2",
        "outputId": "2c7eb7fa-4c0c-4a05-b5d0-289c2cd260ff"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                                                                           User  \\\n",
              "0                                                                                                             1   \n",
              "1                              hi not sure if the charger would work for my car . can you sell it to me for 5 ?   \n",
              "2                                                               still can i buy it for 5 ? i m on a tight budge   \n",
              "3                                         how about 6 and i pick it up myself ? it ll save you shipping to me .   \n",
              "4                                                                                                 eh fine . 7 .   \n",
              "5                                                                                                             2   \n",
              "6                                                                            hi i am interested in your board !   \n",
              "7                                                                     do you know what wood it is made out of ?   \n",
              "8  the wheels seem nice on it but they could be a beter quality . would you accept <price>_-0.2 for the board ?   \n",
              "9                                             if i picked it up at your location would you accpet <price>_0.0 ?   \n",
              "\n",
              "                                                                                                                                 Agent  \\\n",
              "0                                                                                                                                    1   \n",
              "1                                                              it will work i have never seen a car without a cigarette lighter port .   \n",
              "2                                                                                         i think the lowest i would want to go is 8 .   \n",
              "3                                                                                                               7 and we have a deal .   \n",
              "4                                                                                                                                  NaN   \n",
              "5                                                                                                                                    2   \n",
              "6                                                                                                       hi do you have any questions ?   \n",
              "7                                                                   i do not know specifically but the brand is a gravity skateboard .   \n",
              "8  no that offer is too low . the board is pretty much brand new as it s been ridden only or times . the bone bearings are brand new .   \n",
              "9                                                                                              make it <price>_0.4 and we got a deal .   \n",
              "\n",
              "         Slot-Value Value  \\\n",
              "0                 1     1   \n",
              "1               NaN   NaN   \n",
              "2               NaN   NaN   \n",
              "3               NaN   NaN   \n",
              "4               NaN   NaN   \n",
              "5                 2     2   \n",
              "6               NaN   NaN   \n",
              "7               NaN   NaN   \n",
              "8  Price_ratio=-0.2  -0.2   \n",
              "9   Price_ratio=0.0   0.0   \n",
              "\n",
              "                                                                                                                                                              Negotiation Strategy User  \\\n",
              "0                                                                                                                                                                                     1   \n",
              "1  ['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']   \n",
              "2                                                                                                                  ['first_person_singular_count_buyer', 'third_person_singular_buyer']   \n",
              "3                                                     ['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer']   \n",
              "4                                                                                                                                              ['buyer_pos_sentiment', 'buyer_propose']   \n",
              "5                                                                                                                                                                                     2   \n",
              "6                                                                                                                       ['first_person_singular_count_buyer', 'politeness_buyer_greet']   \n",
              "7                                                                                                                                ['third_person_singular_buyer', 'factive_count_buyer']   \n",
              "8                                    ['buyer_pos_sentiment', 'third_person_singular_buyer', 'third_person_plural_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer']   \n",
              "9                                                                            ['first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer']   \n",
              "\n",
              "                                                                                                                                                Negotiation Strategy Agent  \\\n",
              "0                                                                                                                                                                        1   \n",
              "1  ['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']   \n",
              "2                                       ['first_person_singular_count_seller', 'number_of_diff_dic_pos', 'seller_propose', 'hedge_count_seller', 'assertive_count_seller']   \n",
              "3                                                                                                           ['first_person_plural_count_seller', 'number_of_diff_dic_pos']   \n",
              "4                                                                                                                                                                     ['']   \n",
              "5                                                                                                                                                                        2   \n",
              "6                                                                                                                    ['number_of_diff_dic_pos', 'politeness_seller_greet']   \n",
              "7                                                       ['first_person_singular_count_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'factive_count_seller']   \n",
              "8                                                               ['seller_neg_sentiment', 'seller_pos_sentiment', 'third_person_singular_seller', 'number_of_diff_dic_pos']   \n",
              "9                                                         ['first_person_plural_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'seller_propose']   \n",
              "\n",
              "  Agent Dialogue Act         Intent  \n",
              "0                  1              1  \n",
              "1            unknown     init-price  \n",
              "2      counter-price         insist  \n",
              "3      counter-price  counter-price  \n",
              "4                NaN          agree  \n",
              "5                  2              2  \n",
              "6            unknown          intro  \n",
              "7           disagree        inquiry  \n",
              "8        vague-price     init-price  \n",
              "9      counter-price  counter-price  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-48d78c13-a802-445f-b6a5-df5696d5bd9a\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>User</th>\n",
              "      <th>Agent</th>\n",
              "      <th>Slot-Value</th>\n",
              "      <th>Value</th>\n",
              "      <th>Negotiation Strategy User</th>\n",
              "      <th>Negotiation Strategy Agent</th>\n",
              "      <th>Agent Dialogue Act</th>\n",
              "      <th>Intent</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>hi not sure if the charger would work for my car . can you sell it to me for 5 ?</td>\n",
              "      <td>it will work i have never seen a car without a cigarette lighter port .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']</td>\n",
              "      <td>['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']</td>\n",
              "      <td>unknown</td>\n",
              "      <td>init-price</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>still can i buy it for 5 ? i m on a tight budge</td>\n",
              "      <td>i think the lowest i would want to go is 8 .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['first_person_singular_count_buyer', 'third_person_singular_buyer']</td>\n",
              "      <td>['first_person_singular_count_seller', 'number_of_diff_dic_pos', 'seller_propose', 'hedge_count_seller', 'assertive_count_seller']</td>\n",
              "      <td>counter-price</td>\n",
              "      <td>insist</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>how about 6 and i pick it up myself ? it ll save you shipping to me .</td>\n",
              "      <td>7 and we have a deal .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer']</td>\n",
              "      <td>['first_person_plural_count_seller', 'number_of_diff_dic_pos']</td>\n",
              "      <td>counter-price</td>\n",
              "      <td>counter-price</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>eh fine . 7 .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['buyer_pos_sentiment', 'buyer_propose']</td>\n",
              "      <td>['']</td>\n",
              "      <td>NaN</td>\n",
              "      <td>agree</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>2</td>\n",
              "      <td>2</td>\n",
              "      <td>2</td>\n",
              "      <td>2</td>\n",
              "      <td>2</td>\n",
              "      <td>2</td>\n",
              "      <td>2</td>\n",
              "      <td>2</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>hi i am interested in your board !</td>\n",
              "      <td>hi do you have any questions ?</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['first_person_singular_count_buyer', 'politeness_buyer_greet']</td>\n",
              "      <td>['number_of_diff_dic_pos', 'politeness_seller_greet']</td>\n",
              "      <td>unknown</td>\n",
              "      <td>intro</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>do you know what wood it is made out of ?</td>\n",
              "      <td>i do not know specifically but the brand is a gravity skateboard .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['third_person_singular_buyer', 'factive_count_buyer']</td>\n",
              "      <td>['first_person_singular_count_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'factive_count_seller']</td>\n",
              "      <td>disagree</td>\n",
              "      <td>inquiry</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>the wheels seem nice on it but they could be a beter quality . would you accept &lt;price&gt;_-0.2 for the board ?</td>\n",
              "      <td>no that offer is too low . the board is pretty much brand new as it s been ridden only or times . the bone bearings are brand new .</td>\n",
              "      <td>Price_ratio=-0.2</td>\n",
              "      <td>-0.2</td>\n",
              "      <td>['buyer_pos_sentiment', 'third_person_singular_buyer', 'third_person_plural_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer']</td>\n",
              "      <td>['seller_neg_sentiment', 'seller_pos_sentiment', 'third_person_singular_seller', 'number_of_diff_dic_pos']</td>\n",
              "      <td>vague-price</td>\n",
              "      <td>init-price</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>if i picked it up at your location would you accpet &lt;price&gt;_0.0 ?</td>\n",
              "      <td>make it &lt;price&gt;_0.4 and we got a deal .</td>\n",
              "      <td>Price_ratio=0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>['first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer']</td>\n",
              "      <td>['first_person_plural_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'seller_propose']</td>\n",
              "      <td>counter-price</td>\n",
              "      <td>counter-price</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-48d78c13-a802-445f-b6a5-df5696d5bd9a')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-48d78c13-a802-445f-b6a5-df5696d5bd9a button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-48d78c13-a802-445f-b6a5-df5696d5bd9a');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 8
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Nego Strategy :::"
      ],
      "metadata": {
        "id": "oZOSxOSHJ535"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "ns_agent_l = []\n",
        "for i in range(len(clb)):\n",
        "    if str(clb.iloc[i,5])!='nan' and len(str(clb.iloc[i,5]))>2 :\n",
        "        s = clb.iloc[i,5][1:-1].split(',')\n",
        "        try :\n",
        "            for j in s:             \n",
        "                ns_agent_l.append(j.split(\"\\'\")[1])\n",
        "        except:\n",
        "          ns_agent_l.append(\"N\")\n",
        "    else:\n",
        "        ns_agent_l.append(\"N\")\n",
        "  \n",
        "print(len(ns_agent_l))\n",
        "print(len(list(set(ns_agent_l))))"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "yilgTyYpnLK8",
        "outputId": "51eb2e2a-59e5-4ee5-c95c-41db42fc3fbf"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "109959\n",
            "25\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "ns_agent_l = set(ns_agent_l)\n",
        "ns_agent_l.discard('')\n",
        "ns_agent_l.discard('N')\n",
        "ns_agent_l = list(ns_agent_l)\n",
        "ns_agent_l"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "EXDpU4g5xzv6",
        "outputId": "44942605-1f46-46b0-ee4b-b7caa73e18c9"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "['factive_count_seller',\n",
              " 'politeness_seller_please_s',\n",
              " 'seller_propose',\n",
              " 'politeness_seller_greet',\n",
              " 'personal_concern_seller',\n",
              " 'seller_neg_sentiment',\n",
              " 'friend',\n",
              " 'number_of_diff_dic_pos',\n",
              " 'hedge_count_seller',\n",
              " 'family',\n",
              " 'politeness_seller_gratitude',\n",
              " 'seller_pos_sentiment',\n",
              " 'seller_trade_in',\n",
              " 'who_propose',\n",
              " 'third_person_singular_seller',\n",
              " 'liwc_informal',\n",
              " 'liwc_certainty',\n",
              " 'third_person_plural_seller',\n",
              " 'first_person_singular_count_seller',\n",
              " 'politeness_seller_please',\n",
              " 'assertive_count_seller',\n",
              " 'first_person_plural_count_seller',\n",
              " 'number_of_diff_dic_neg']"
            ]
          },
          "metadata": {},
          "execution_count": 10
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "ns_agent_l = list(set(ns_agent_l))\n",
        "ind = list(np.arange(len(ns_agent_l)))\n",
        "\n",
        "d_ns_agent = {}\n",
        "\n",
        "for i in range(len(ind)):  \n",
        "    d_ns_agent[ns_agent_l[i]] = ind[i]\n",
        "\n",
        "d_ns_agent"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "-f3UJKu8n63m",
        "outputId": "05a25302-4aee-4f55-988a-908c9df97121"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "{'factive_count_seller': 0,\n",
              " 'politeness_seller_please_s': 1,\n",
              " 'seller_propose': 2,\n",
              " 'politeness_seller_greet': 3,\n",
              " 'personal_concern_seller': 4,\n",
              " 'seller_neg_sentiment': 5,\n",
              " 'friend': 6,\n",
              " 'number_of_diff_dic_pos': 7,\n",
              " 'hedge_count_seller': 8,\n",
              " 'family': 9,\n",
              " 'politeness_seller_gratitude': 10,\n",
              " 'seller_pos_sentiment': 11,\n",
              " 'seller_trade_in': 12,\n",
              " 'who_propose': 13,\n",
              " 'third_person_singular_seller': 14,\n",
              " 'liwc_informal': 15,\n",
              " 'liwc_certainty': 16,\n",
              " 'third_person_plural_seller': 17,\n",
              " 'first_person_singular_count_seller': 18,\n",
              " 'politeness_seller_please': 19,\n",
              " 'assertive_count_seller': 20,\n",
              " 'first_person_plural_count_seller': 21,\n",
              " 'number_of_diff_dic_neg': 22}"
            ]
          },
          "metadata": {},
          "execution_count": 11
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "edge_tuple = []\n",
        "\n",
        "for i in range(len(clb)):\n",
        "    if not str(clb.iloc[i,0]).isdigit():\n",
        "        s = clb.iloc[i,5][1:-1].split(\",\")\n",
        "        if len(s) > 1 :\n",
        "            a = [j.split(\"\\'\")[1] for j in s]\n",
        "            \n",
        "            if \"\" in a:\n",
        "                a.remove(\"\")\n",
        "            if \"N\" in a:\n",
        "                a.remove(\"N\")    \n",
        "\n",
        "            x = a[:-1]\n",
        "            y = a[1:]\n",
        "\n",
        "            x = [[d_ns_agent[j]] for j in x]\n",
        "            y = [[d_ns_agent[j]] for j in y]\n",
        "\n",
        "            edge = [(x[i][0],y[i][0]) for i in range(len(x))]\n",
        "            edge_tuple = edge_tuple + edge"
      ],
      "metadata": {
        "id": "erXtvRXsF1eN"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "edge_tuple = list(set(edge_tuple))\n",
        "len(edge_tuple)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "_XGrk73PTT80",
        "outputId": "1db621b8-a03d-4d06-a7df-b3aa063bc1d9"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "264"
            ]
          },
          "metadata": {},
          "execution_count": 13
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "edge_source = [i[0] for i in edge_tuple]\n",
        "edge_dest = [i[1] for i in edge_tuple]\n",
        "\n",
        "edge_index = [edge_source,edge_dest]"
      ],
      "metadata": {
        "id": "arl0MhjGUwd7"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "x"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "IXu_ZW12iEdw",
        "outputId": "fe150399-dfce-4a21-9138-071c088006ca"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "[[7]]"
            ]
          },
          "metadata": {},
          "execution_count": 15
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "x = [[i] for i in range(len(ns_agent_l))]\n",
        "x = torch.tensor(x, dtype=torch.float)\n",
        "edge_index = torch.tensor(edge_index, dtype=torch.long)\n",
        "dataset = Data(x=x, y=y, edge_index=edge_index)\n",
        "device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\n",
        "data = dataset.to(device)\n"
      ],
      "metadata": {
        "id": "tvSIy-avQji6",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "d494c699-bfe9-43f6-c05c-4f3891572610"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-17-84d166f974b6>:3: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).\n",
            "  edge_index = torch.tensor(edge_index, dtype=torch.long)\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "class GAT(torch.nn.Module):\n",
        "    def __init__(self):\n",
        "        super(GAT, self).__init__()\n",
        "        self.hid = 8\n",
        "        self.in_head = 8\n",
        "        self.out_head = 1\n",
        "        self.num_classes = 25\n",
        "        \n",
        "        self.conv1 = GATConv(dataset.num_features, self.hid, heads=self.in_head, edge_dim = 1)\n",
        "        self.conv2 = GATConv(self.hid*self.in_head, 50, concat=False,\n",
        "                             heads=8, edge_dim = 1)\n",
        "        self.conv3 = GATConv(50,25,concat=False, edge_dim = 1)\n",
        "        self.conv4 = GATConv(25,5)\n",
        "\n",
        "    def forward(self, data):\n",
        "        x, edge_index= data.x, data.edge_index\n",
        "        x = (self.conv1(x, edge_index))\n",
        "        x = (self.conv2(x, edge_index))\n",
        "        x = self.conv3(x, edge_index)\n",
        "        x = self.conv4(x, edge_index)\n",
        "        \n",
        "        return (x)\n",
        "        \n",
        "model = GAT().to(device)"
      ],
      "metadata": {
        "id": "SMWXuTGoQkzb"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "model.train()\n",
        "outputs = []\n",
        "\n",
        "\n",
        "\n",
        "for i in range(50):   \n",
        "    out = model(data).type(torch.FloatTensor)\n",
        "    outputs.append(out)"
      ],
      "metadata": {
        "id": "X5I3fsoIdQQz"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "outputs[-1]*10000"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "NJZy4dvz20Fs",
        "outputId": "51ef9852-2352-426f-e367-a742bb9d585a"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "tensor([[-3678.2053,  1618.5809, -5768.2031,  5368.6572,  7347.3550],\n",
              "        [-3674.6389,  1610.1393, -5794.4219,  5390.0767,  7376.8257],\n",
              "        [-3687.0627,  1631.0425, -5769.0791,  5368.8389,  7348.3311],\n",
              "        [-3675.8547,  1609.2190, -5803.3364,  5398.7119,  7388.0952],\n",
              "        [-3673.7910,  1610.5140, -5781.2266,  5380.2495,  7361.6938],\n",
              "        [-3676.0610,  1611.1135, -5808.4692,  5402.5464,  7392.7002],\n",
              "        [-3671.6311,  1605.2032, -5797.6538,  5393.4683,  7381.1807],\n",
              "        [-3677.8882,  1616.1155, -5790.3965,  5387.6812,  7371.7378],\n",
              "        [-3685.0459,  1624.9315, -5776.1484,  5377.4775,  7357.2119],\n",
              "        [-3672.4187,  1607.6600, -5802.8262,  5395.9404,  7385.0557],\n",
              "        [-3670.8674,  1605.6176, -5796.2329,  5389.9639,  7378.4043],\n",
              "        [-3680.1731,  1617.6873, -5799.5718,  5395.7485,  7382.2944],\n",
              "        [-3666.8896,  1604.1775, -5774.7920,  5370.6484,  7353.0776],\n",
              "        [-3665.2256,  1598.4028, -5773.7588,  5374.2451,  7354.6411],\n",
              "        [-3683.9568,  1622.3293, -5793.1226,  5392.7603,  7375.5898],\n",
              "        [-3671.1118,  1608.0133, -5793.6060,  5387.9678,  7374.5542],\n",
              "        [-3671.3313,  1609.9087, -5785.5190,  5380.2681,  7365.0229],\n",
              "        [-3695.2578,  1641.3744, -5784.1821,  5386.5093,  7363.1035],\n",
              "        [-3680.8018,  1619.3429, -5798.4678,  5396.2827,  7379.9531],\n",
              "        [-3668.8899,  1606.0234, -5797.3999,  5388.9507,  7377.0439],\n",
              "        [-3681.2490,  1622.4958, -5767.4448,  5368.0068,  7346.4795],\n",
              "        [-3693.9114,  1631.8101, -5792.3530,  5398.5034,  7378.8418],\n",
              "        [-3688.4163,  1633.0482, -5776.4917,  5376.8892,  7355.5005]],\n",
              "       grad_fn=<MulBackward0>)"
            ]
          },
          "metadata": {},
          "execution_count": 39
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "n_strategy_dict = {'assertive_count_seller': 0,\n",
        " 'seller_neg_sentiment': 1,\n",
        " 'politeness_seller_please': 2,\n",
        " 'first_person_plural_count_seller': 3,\n",
        " 'third_person_singular_seller': 4,\n",
        " 'politeness_seller_greet': 5,\n",
        " 'third_person_plural_seller': 6,\n",
        " 'liwc_certainty': 7,\n",
        " 'hedge_count_seller': 8,\n",
        " 'first_person_singular_count_seller': 9,\n",
        " 'who_propose': 10,\n",
        " 'seller_propose': 11,\n",
        " 'number_of_diff_dic_pos': 12,\n",
        " 'politeness_seller_please_s': 13,\n",
        " 'friend': 14,\n",
        " 'seller_pos_sentiment': 15,\n",
        " 'family': 16,\n",
        " 'seller_trade_in': 17,\n",
        " 'liwc_informal': 18,\n",
        " 'personal_concern_seller': 19,\n",
        " 'factive_count_seller': 20,\n",
        " 'politeness_seller_gratitude': 21,\n",
        " 'number_of_diff_dic_neg': 22}\n",
        "\n",
        "n_strategy_GAT_embeddings = [[-3678.2053,  1618.5809, -5768.2031,  5368.6572,  7347.3550],\n",
        "        [-3674.6389,  1610.1393, -5794.4219,  5390.0767,  7376.8257],\n",
        "        [-3687.0627,  1631.0425, -5769.0791,  5368.8389,  7348.3311],\n",
        "        [-3675.8547,  1609.2190, -5803.3364,  5398.7119,  7388.0952],\n",
        "        [-3673.7910,  1610.5140, -5781.2266,  5380.2495,  7361.6938],\n",
        "        [-3676.0610,  1611.1135, -5808.4692,  5402.5464,  7392.7002],\n",
        "        [-3671.6311,  1605.2032, -5797.6538,  5393.4683,  7381.1807],\n",
        "        [-3677.8882,  1616.1155, -5790.3965,  5387.6812,  7371.7378],\n",
        "        [-3685.0459,  1624.9315, -5776.1484,  5377.4775,  7357.2119],\n",
        "        [-3672.4187,  1607.6600, -5802.8262,  5395.9404,  7385.0557],\n",
        "        [-3670.8674,  1605.6176, -5796.2329,  5389.9639,  7378.4043],\n",
        "        [-3680.1731,  1617.6873, -5799.5718,  5395.7485,  7382.2944],\n",
        "        [-3666.8896,  1604.1775, -5774.7920,  5370.6484,  7353.0776],\n",
        "        [-3665.2256,  1598.4028, -5773.7588,  5374.2451,  7354.6411],\n",
        "        [-3683.9568,  1622.3293, -5793.1226,  5392.7603,  7375.5898],\n",
        "        [-3671.1118,  1608.0133, -5793.6060,  5387.9678,  7374.5542],\n",
        "        [-3671.3313,  1609.9087, -5785.5190,  5380.2681,  7365.0229],\n",
        "        [-3695.2578,  1641.3744, -5784.1821,  5386.5093,  7363.1035],\n",
        "        [-3680.8018,  1619.3429, -5798.4678,  5396.2827,  7379.9531],\n",
        "        [-3668.8899,  1606.0234, -5797.3999,  5388.9507,  7377.0439],\n",
        "        [-3681.2490,  1622.4958, -5767.4448,  5368.0068,  7346.4795],\n",
        "        [-3693.9114,  1631.8101, -5792.3530,  5398.5034,  7378.8418],\n",
        "        [-3688.4163,  1633.0482, -5776.4917,  5376.8892,  7355.5005]]"
      ],
      "metadata": {
        "id": "ypSzQqWRh7wB"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "clb['GAT_n_strategy_agent'] = np.zeros(len(clb))\n",
        "\n",
        "for i in range(len(clb)):\n",
        "    ns_agent_l = []\n",
        "    if str(clb.iloc[i,5])!='nan' and len(str(clb.iloc[i,5]))>2 :\n",
        "        s = clb.iloc[i,5][1:-1].split(',')\n",
        "        try :\n",
        "            for j in s:    \n",
        "                a = j.split(\"\\'\")[1]         \n",
        "                ns_agent_l.append(a)\n",
        "\n",
        "                # for embedding size == 1 :\n",
        "                # ns_agent_l.append(str(int(n_strategy_GAT_embeddings[n_strategy_dict[a]][0])))\n",
        "\n",
        "                #for embedding size > 1 :\n",
        "                l = n_strategy_GAT_embeddings[n_strategy_dict[a]]\n",
        "                for ll in l :\n",
        "                    ns_agent_l.append(str(int(ll)))\n",
        "        except:\n",
        "          ns_agent_l.append(\"\")\n",
        "    else:\n",
        "        ns_agent_l.append(\"\")\n",
        "\n",
        "    clb['GAT_n_strategy_agent'][i] = str(ns_agent_l)\n",
        "\n",
        "clb.head(3)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 604
        },
        "id": "xMPuI_NfAI3h",
        "outputId": "94aa81b2-b22f-46c2-ed28-8e51b03efd37"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-51-2a6ca32d69b6>:24: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  clb['GAT_n_strategy_agent'][i] = str(ns_agent_l)\n",
            "/usr/local/lib/python3.8/dist-packages/pandas/core/indexing.py:1732: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  self._setitem_single_block(indexer, value, name)\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                                               User  \\\n",
              "0                                                                                 1   \n",
              "1  hi not sure if the charger would work for my car . can you sell it to me for 5 ?   \n",
              "2                                   still can i buy it for 5 ? i m on a tight budge   \n",
              "\n",
              "                                                                     Agent  \\\n",
              "0                                                                        1   \n",
              "1  it will work i have never seen a car without a cigarette lighter port .   \n",
              "2                             i think the lowest i would want to go is 8 .   \n",
              "\n",
              "  Slot-Value Value  \\\n",
              "0          1     1   \n",
              "1        NaN   NaN   \n",
              "2        NaN   NaN   \n",
              "\n",
              "                                                                                                                                                              Negotiation Strategy User  \\\n",
              "0                                                                                                                                                                                     1   \n",
              "1  ['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']   \n",
              "2                                                                                                                  ['first_person_singular_count_buyer', 'third_person_singular_buyer']   \n",
              "\n",
              "                                                                                                                                                Negotiation Strategy Agent  \\\n",
              "0                                                                                                                                                                        1   \n",
              "1  ['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']   \n",
              "2                                       ['first_person_singular_count_seller', 'number_of_diff_dic_pos', 'seller_propose', 'hedge_count_seller', 'assertive_count_seller']   \n",
              "\n",
              "  Agent Dialogue Act      Intent  \\\n",
              "0                  1           1   \n",
              "1            unknown  init-price   \n",
              "2      counter-price      insist   \n",
              "\n",
              "                                                                                                                                                                                                                                                                                                                                                                                                                  GAT_n_strategy_agent  \n",
              "0                                                                                                                                                                                                                                                                                                                                                                                                                                 ['']  \n",
              "1  ['first_person_singular_count_seller', '-3672', '1607', '-5802', '5395', '7385', 'third_person_singular_seller', '-3673', '1610', '-5781', '5380', '7361', 'number_of_diff_dic_pos', '-3666', '1604', '-5774', '5370', '7353', 'number_of_diff_dic_neg', '-3688', '1633', '-5776', '5376', '7355', 'personal_concern_seller', '-3668', '1606', '-5797', '5388', '7377', 'liwc_certainty', '-3677', '1616', '-5790', '5387', '7371']  \n",
              "2                                                                                 ['first_person_singular_count_seller', '-3672', '1607', '-5802', '5395', '7385', 'number_of_diff_dic_pos', '-3666', '1604', '-5774', '5370', '7353', 'seller_propose', '-3680', '1617', '-5799', '5395', '7382', 'hedge_count_seller', '-3685', '1624', '-5776', '5377', '7357', 'assertive_count_seller', '-3678', '1618', '-5768', '5368', '7347']  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-bd898a89-6664-4722-adb9-6b2f4dcd3d55\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>User</th>\n",
              "      <th>Agent</th>\n",
              "      <th>Slot-Value</th>\n",
              "      <th>Value</th>\n",
              "      <th>Negotiation Strategy User</th>\n",
              "      <th>Negotiation Strategy Agent</th>\n",
              "      <th>Agent Dialogue Act</th>\n",
              "      <th>Intent</th>\n",
              "      <th>GAT_n_strategy_agent</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>['']</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>hi not sure if the charger would work for my car . can you sell it to me for 5 ?</td>\n",
              "      <td>it will work i have never seen a car without a cigarette lighter port .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']</td>\n",
              "      <td>['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']</td>\n",
              "      <td>unknown</td>\n",
              "      <td>init-price</td>\n",
              "      <td>['first_person_singular_count_seller', '-3672', '1607', '-5802', '5395', '7385', 'third_person_singular_seller', '-3673', '1610', '-5781', '5380', '7361', 'number_of_diff_dic_pos', '-3666', '1604', '-5774', '5370', '7353', 'number_of_diff_dic_neg', '-3688', '1633', '-5776', '5376', '7355', 'personal_concern_seller', '-3668', '1606', '-5797', '5388', '7377', 'liwc_certainty', '-3677', '1616', '-5790', '5387', '7371']</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>still can i buy it for 5 ? i m on a tight budge</td>\n",
              "      <td>i think the lowest i would want to go is 8 .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['first_person_singular_count_buyer', 'third_person_singular_buyer']</td>\n",
              "      <td>['first_person_singular_count_seller', 'number_of_diff_dic_pos', 'seller_propose', 'hedge_count_seller', 'assertive_count_seller']</td>\n",
              "      <td>counter-price</td>\n",
              "      <td>insist</td>\n",
              "      <td>['first_person_singular_count_seller', '-3672', '1607', '-5802', '5395', '7385', 'number_of_diff_dic_pos', '-3666', '1604', '-5774', '5370', '7353', 'seller_propose', '-3680', '1617', '-5799', '5395', '7382', 'hedge_count_seller', '-3685', '1624', '-5776', '5377', '7357', 'assertive_count_seller', '-3678', '1618', '-5768', '5368', '7347']</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-bd898a89-6664-4722-adb9-6b2f4dcd3d55')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-bd898a89-6664-4722-adb9-6b2f4dcd3d55 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-bd898a89-6664-4722-adb9-6b2f4dcd3d55');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 51
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "clb['GAT_n_strategy_agent'][1]"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 70
        },
        "id": "Xm9rXgX2BzxU",
        "outputId": "4e2d6164-a3c2-43dc-a1a1-6ded7bbe1204"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "\"['first_person_singular_count_seller', '-3672', '1607', '-5802', '5395', '7385', 'third_person_singular_seller', '-3673', '1610', '-5781', '5380', '7361', 'number_of_diff_dic_pos', '-3666', '1604', '-5774', '5370', '7353', 'number_of_diff_dic_neg', '-3688', '1633', '-5776', '5376', '7355', 'personal_concern_seller', '-3668', '1606', '-5797', '5388', '7377', 'liwc_certainty', '-3677', '1616', '-5790', '5387', '7371']\""
            ],
            "application/vnd.google.colaboratory.intrinsic+json": {
              "type": "string"
            }
          },
          "metadata": {},
          "execution_count": 52
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "clb.to_csv(\"CLB_GAT_5_emb_int_n_strategy.csv\", index=False)"
      ],
      "metadata": {
        "id": "-MqyPgU7CNz2"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "myboXFosGYfC"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Action :::"
      ],
      "metadata": {
        "id": "9Buj8Bd_KBuU"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "clb = pd.read_csv(\"CLB_GAT_act.csv\")\n",
        "clb.head(2)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 295
        },
        "id": "2pp_I-8VtBdR",
        "outputId": "ff197b18-f222-400d-c41f-ce1f721237e9"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                                               User  \\\n",
              "0                                                                                 1   \n",
              "1  hi not sure if the charger would work for my car . can you sell it to me for 5 ?   \n",
              "\n",
              "                                                                     Agent  \\\n",
              "0                                                                        1   \n",
              "1  it will work i have never seen a car without a cigarette lighter port .   \n",
              "\n",
              "  Slot-Value Value  \\\n",
              "0          1     1   \n",
              "1        NaN   NaN   \n",
              "\n",
              "                                                                                                                                                              Negotiation Strategy User  \\\n",
              "0                                                                                                                                                                                     1   \n",
              "1  ['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']   \n",
              "\n",
              "                                                                                                                                                Negotiation Strategy Agent  \\\n",
              "0                                                                                                                                                                        1   \n",
              "1  ['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']   \n",
              "\n",
              "  Agent Dialogue Act      Intent             GAT_act_agent  \n",
              "0                  1           1                      ['']  \n",
              "1            unknown  init-price  ['unknown', '10641.959']  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-1a2fef56-28b9-4299-a7d8-e0a5fc989681\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>User</th>\n",
              "      <th>Agent</th>\n",
              "      <th>Slot-Value</th>\n",
              "      <th>Value</th>\n",
              "      <th>Negotiation Strategy User</th>\n",
              "      <th>Negotiation Strategy Agent</th>\n",
              "      <th>Agent Dialogue Act</th>\n",
              "      <th>Intent</th>\n",
              "      <th>GAT_act_agent</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>['']</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>hi not sure if the charger would work for my car . can you sell it to me for 5 ?</td>\n",
              "      <td>it will work i have never seen a car without a cigarette lighter port .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']</td>\n",
              "      <td>['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']</td>\n",
              "      <td>unknown</td>\n",
              "      <td>init-price</td>\n",
              "      <td>['unknown', '10641.959']</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-1a2fef56-28b9-4299-a7d8-e0a5fc989681')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-1a2fef56-28b9-4299-a7d8-e0a5fc989681 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-1a2fef56-28b9-4299-a7d8-e0a5fc989681');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 91
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "act_agent_l = []\n",
        "for i in range(len(clb)):\n",
        "    s = clb.iloc[i,6]\n",
        "    if str(s)!='nan' and not str(s).isdigit() :       \n",
        "        try :   \n",
        "            for j in s.split(\",\"):      \n",
        "                act_agent_l.append(j)\n",
        "        except:\n",
        "            act_agent_l.append(\"N\")\n",
        "    else:\n",
        "        act_agent_l.append(\"N\")\n",
        "  \n",
        "print(len(act_agent_l))\n",
        "print(len(list(set(act_agent_l))))"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "yuwz_XzYJ_-W",
        "outputId": "7cfe5f04-411b-4015-db3f-e56b9775d951"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "32836\n",
            "13\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "act_agent_l = list(set(act_agent_l))\n",
        "act_agent_l"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "sDE1MAdjNdJA",
        "outputId": "607688aa-023c-48de-88b7-563c17c9b783"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "['agree',\n",
              " 'vague-price',\n",
              " 'N',\n",
              " 'intro',\n",
              " 'unknown',\n",
              " 'disagreedisagree',\n",
              " 'inform',\n",
              " 'init-price',\n",
              " 'counter-pricedisagree',\n",
              " 'insist',\n",
              " 'counter-price',\n",
              " 'disagree',\n",
              " 'inquiry']"
            ]
          },
          "metadata": {},
          "execution_count": 472
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "act_agent_l = set(act_agent_l)\n",
        "# act_agent_l.discard('')\n",
        "act_agent_l.discard('N')\n",
        "act_agent_l = list(act_agent_l)\n",
        "act_agent_l"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "WwlIvAqZgmLq",
        "outputId": "2a6f51bc-07f7-4902-e2f2-964b6ad8c059"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "['disagree',\n",
              " 'agree',\n",
              " 'vague-price',\n",
              " 'intro',\n",
              " 'unknown',\n",
              " 'disagreedisagree',\n",
              " 'init-price',\n",
              " 'counter-pricedisagree',\n",
              " 'insist',\n",
              " 'counter-price',\n",
              " 'inform',\n",
              " 'inquiry']"
            ]
          },
          "metadata": {},
          "execution_count": 473
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "act_agent_l = list(set(act_agent_l))\n",
        "ind = list(np.arange(len(act_agent_l)))\n",
        "\n",
        "d_act_agent = {}\n",
        "\n",
        "for i in range(len(ind)):  \n",
        "    d_act_agent[act_agent_l[i]] = ind[i]\n",
        "\n",
        "d_act_agent"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "5GM5RKKNuLDd",
        "outputId": "b87e8343-7825-4fe7-af2b-07512b93dbfa"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "{'agree': 0,\n",
              " 'vague-price': 1,\n",
              " 'intro': 2,\n",
              " 'unknown': 3,\n",
              " 'disagreedisagree': 4,\n",
              " 'init-price': 5,\n",
              " 'inform': 6,\n",
              " 'counter-pricedisagree': 7,\n",
              " 'insist': 8,\n",
              " 'counter-price': 9,\n",
              " 'disagree': 10,\n",
              " 'inquiry': 11}"
            ]
          },
          "metadata": {},
          "execution_count": 474
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "class GAT(torch.nn.Module):\n",
        "    def __init__(self):\n",
        "        super(GAT, self).__init__()\n",
        "        self.hid = 8\n",
        "        self.in_head = 8\n",
        "        self.out_head = 1\n",
        "        self.num_classes = 25\n",
        "        \n",
        "        self.conv1 = GATConv(1, self.hid, heads=self.in_head, edge_dim = 1)\n",
        "        self.conv2 = GATConv(self.hid*self.in_head, 50, concat=False,\n",
        "                             heads=8, edge_dim = 1)\n",
        "        self.conv3 = GATConv(50,1,concat=True, edge_dim = 1)\n",
        "\n",
        "    def forward(self, data):\n",
        "        x, edge_index= data.x, data.edge_index\n",
        "        x = F.relu(self.conv1(x, edge_index))\n",
        "        x = F.relu(self.conv2(x, edge_index))\n",
        "        x = self.conv3(x, edge_index)\n",
        "        \n",
        "        return F.selu(x)\n",
        "        \n",
        "device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\n",
        "model = GAT().to(device)"
      ],
      "metadata": {
        "id": "wFubAGBauZrn"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "edge_tuple = []\n",
        "\n",
        "for i in range(len(clb)):\n",
        "    if not str(clb.iloc[i,0]).isdigit():\n",
        "        s = str(clb.iloc[i,6]).split(\",\")\n",
        "        if len(s) > 1 :\n",
        "            a = s\n",
        "                        \n",
        "            if \"\" in a:\n",
        "                a.remove(\"\")\n",
        "            if \"N\" in a:\n",
        "                a.remove(\"N\")    \n",
        "\n",
        "            x = a[:-1]\n",
        "            y = a[1:]\n",
        "\n",
        "            x = [[d_act_agent[j]] for j in x]\n",
        "            y = [[d_act_agent[j]] for j in y]\n",
        "\n",
        "            edge = [(x[i][0],y[i][0]) for i in range(len(x))]\n",
        "            edge_tuple = edge_tuple + edge"
      ],
      "metadata": {
        "id": "F8Jva1wDugiI"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "edge_tuple = list(set(edge_tuple))\n",
        "len(edge_tuple)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Sga6CNuYvAM0",
        "outputId": "8e087426-bfd9-49cb-af51-74d9ce2c3cf8"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "42"
            ]
          },
          "metadata": {},
          "execution_count": 484
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "edge_source = [i[0] for i in edge_tuple]\n",
        "edge_dest = [i[1] for i in edge_tuple]\n",
        "\n",
        "edge_index = [edge_source,edge_dest]"
      ],
      "metadata": {
        "id": "Ah9uwOCWvaom"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "x"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "yATY96epvfp8",
        "outputId": "97582d82-94ee-4fbe-d484-94bb7db01bf4"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "[[2]]"
            ]
          },
          "metadata": {},
          "execution_count": 487
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "model.train()\n",
        "outputs = []\n",
        "\n",
        "x = [[i] for i in range(len(act_agent_l))]\n",
        "x = torch.tensor(x, dtype=torch.float)\n",
        "edge_index = torch.tensor(edge_index, dtype=torch.long)\n",
        "dataset = Data(x=x, y=y, edge_index=edge_index)\n",
        "data = dataset.to(device)\n",
        "\n",
        "\n",
        "for i in range(50):   \n",
        "    out = model(data).type(torch.FloatTensor)\n",
        "    outputs.append(out)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "IO5Gob1ovkfM",
        "outputId": "a280ba09-0bd7-4511-b6ac-78ab4a831493"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-490-004956f59131>:6: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).\n",
            "  edge_index = torch.tensor(edge_index, dtype=torch.long)\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "outputs[0]*100000"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Ct7aVXxav2uj",
        "outputId": "06d61002-692c-4a5e-d92f-c0b4850cf955"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "tensor([[10337.1543],\n",
              "        [11375.1621],\n",
              "        [ 4848.9819],\n",
              "        [10641.9590],\n",
              "        [ 9697.9639],\n",
              "        [ 9801.6201],\n",
              "        [11635.8428],\n",
              "        [16971.4336],\n",
              "        [11822.1680],\n",
              "        [ 9800.2979],\n",
              "        [ 9909.3330],\n",
              "        [10277.1064]], grad_fn=<MulBackward0>)"
            ]
          },
          "metadata": {},
          "execution_count": 491
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "act_dict = {'agree': 0,\n",
        " 'vague-price': 1,\n",
        " 'intro': 2,\n",
        " 'unknown': 3,\n",
        " 'disagreedisagree': 4,\n",
        " 'init-price': 5,\n",
        " 'inform': 6,\n",
        " 'counter-pricedisagree': 7,\n",
        " 'insist': 8,\n",
        " 'counter-price': 9,\n",
        " 'disagree': 10,\n",
        " 'inquiry': 11}\n",
        "\n",
        "act_GAT_embeddings = [[10337.1543],\n",
        "        [11375.1621],\n",
        "        [ 4848.9819],\n",
        "        [10641.9590],\n",
        "        [ 9697.9639],\n",
        "        [ 9801.6201],\n",
        "        [11635.8428],\n",
        "        [16971.4336],\n",
        "        [11822.1680],\n",
        "        [ 9800.2979],\n",
        "        [ 9909.3330],\n",
        "        [10277.1064]]\n",
        "\n"
      ],
      "metadata": {
        "id": "s43VpGhWw_uV"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "clb['GAT_act_agent'] = np.zeros(len(clb))\n",
        "\n",
        "for i in range(len(clb)):\n",
        "    s = clb.iloc[i,6]\n",
        "    act_agent_l = []\n",
        "    if str(s)!='nan' and not str(s).isdigit() :       \n",
        "        try :   \n",
        "            for j in s.split(\",\"):      \n",
        "                act_agent_l.append(j)\n",
        "                act_agent_l.append(str(int(act_GAT_embeddings[act_dict[j]][0])))\n",
        "        except:\n",
        "            act_agent_l.append(\"\")\n",
        "    else:\n",
        "        act_agent_l.append(\"\")\n",
        "\n",
        "    clb['GAT_act_agent'][i] = str(act_agent_l)\n",
        "\n",
        "clb.head(2)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 468
        },
        "id": "HUWKhpX9xYba",
        "outputId": "a5103a8c-e0ae-492a-a27b-f9ee540057ad"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-93-6d54ffdb43ad>:16: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  clb['GAT_act_agent'][i] = str(act_agent_l)\n",
            "/usr/local/lib/python3.8/dist-packages/pandas/core/indexing.py:1732: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  self._setitem_single_block(indexer, value, name)\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                                               User  \\\n",
              "0                                                                                 1   \n",
              "1  hi not sure if the charger would work for my car . can you sell it to me for 5 ?   \n",
              "\n",
              "                                                                     Agent  \\\n",
              "0                                                                        1   \n",
              "1  it will work i have never seen a car without a cigarette lighter port .   \n",
              "\n",
              "  Slot-Value Value  \\\n",
              "0          1     1   \n",
              "1        NaN   NaN   \n",
              "\n",
              "                                                                                                                                                              Negotiation Strategy User  \\\n",
              "0                                                                                                                                                                                     1   \n",
              "1  ['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']   \n",
              "\n",
              "                                                                                                                                                Negotiation Strategy Agent  \\\n",
              "0                                                                                                                                                                        1   \n",
              "1  ['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']   \n",
              "\n",
              "  Agent Dialogue Act      Intent         GAT_act_agent  \n",
              "0                  1           1                  ['']  \n",
              "1            unknown  init-price  ['unknown', '10641']  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-1a5a98ac-7746-4c0b-a530-c27d73654fe2\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>User</th>\n",
              "      <th>Agent</th>\n",
              "      <th>Slot-Value</th>\n",
              "      <th>Value</th>\n",
              "      <th>Negotiation Strategy User</th>\n",
              "      <th>Negotiation Strategy Agent</th>\n",
              "      <th>Agent Dialogue Act</th>\n",
              "      <th>Intent</th>\n",
              "      <th>GAT_act_agent</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>['']</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>hi not sure if the charger would work for my car . can you sell it to me for 5 ?</td>\n",
              "      <td>it will work i have never seen a car without a cigarette lighter port .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']</td>\n",
              "      <td>['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']</td>\n",
              "      <td>unknown</td>\n",
              "      <td>init-price</td>\n",
              "      <td>['unknown', '10641']</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-1a5a98ac-7746-4c0b-a530-c27d73654fe2')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-1a5a98ac-7746-4c0b-a530-c27d73654fe2 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-1a5a98ac-7746-4c0b-a530-c27d73654fe2');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 93
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "clb.to_csv(\"CLB_GAT_int_act.csv\", index=False)"
      ],
      "metadata": {
        "id": "I7sm98pEyTP4"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Merging :::"
      ],
      "metadata": {
        "id": "FXQN4TBgyqb3"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "act_embed = pd.read_csv(\"CLB_GAT_int_act.csv\")\n",
        "act_embed.head(2)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 295
        },
        "id": "1kh0zEh6yg2_",
        "outputId": "389242ea-f93c-4cd6-d301-21e4938c75b2"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                                               User  \\\n",
              "0                                                                                 1   \n",
              "1  hi not sure if the charger would work for my car . can you sell it to me for 5 ?   \n",
              "\n",
              "                                                                     Agent  \\\n",
              "0                                                                        1   \n",
              "1  it will work i have never seen a car without a cigarette lighter port .   \n",
              "\n",
              "  Slot-Value Value  \\\n",
              "0          1     1   \n",
              "1        NaN   NaN   \n",
              "\n",
              "                                                                                                                                                              Negotiation Strategy User  \\\n",
              "0                                                                                                                                                                                     1   \n",
              "1  ['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']   \n",
              "\n",
              "                                                                                                                                                Negotiation Strategy Agent  \\\n",
              "0                                                                                                                                                                        1   \n",
              "1  ['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']   \n",
              "\n",
              "  Agent Dialogue Act      Intent         GAT_act_agent  \n",
              "0                  1           1                  ['']  \n",
              "1            unknown  init-price  ['unknown', '10641']  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-822efcd4-4e7f-4055-a547-25e0981d9eeb\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>User</th>\n",
              "      <th>Agent</th>\n",
              "      <th>Slot-Value</th>\n",
              "      <th>Value</th>\n",
              "      <th>Negotiation Strategy User</th>\n",
              "      <th>Negotiation Strategy Agent</th>\n",
              "      <th>Agent Dialogue Act</th>\n",
              "      <th>Intent</th>\n",
              "      <th>GAT_act_agent</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>['']</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>hi not sure if the charger would work for my car . can you sell it to me for 5 ?</td>\n",
              "      <td>it will work i have never seen a car without a cigarette lighter port .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']</td>\n",
              "      <td>['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']</td>\n",
              "      <td>unknown</td>\n",
              "      <td>init-price</td>\n",
              "      <td>['unknown', '10641']</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-822efcd4-4e7f-4055-a547-25e0981d9eeb')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-822efcd4-4e7f-4055-a547-25e0981d9eeb button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-822efcd4-4e7f-4055-a547-25e0981d9eeb');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 95
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "n_strategy_embed = pd.read_csv(\"CLB_GAT_int_n_strategy.csv\")\n",
        "n_strategy_embed.head(2)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 364
        },
        "id": "vkbtCSa1ymCy",
        "outputId": "832e5c3f-10ad-4599-adaf-253bac0027ae"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                                               User  \\\n",
              "0                                                                                 1   \n",
              "1  hi not sure if the charger would work for my car . can you sell it to me for 5 ?   \n",
              "\n",
              "                                                                     Agent  \\\n",
              "0                                                                        1   \n",
              "1  it will work i have never seen a car without a cigarette lighter port .   \n",
              "\n",
              "  Slot-Value Value  \\\n",
              "0          1     1   \n",
              "1        NaN   NaN   \n",
              "\n",
              "                                                                                                                                                              Negotiation Strategy User  \\\n",
              "0                                                                                                                                                                                     1   \n",
              "1  ['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']   \n",
              "\n",
              "                                                                                                                                                Negotiation Strategy Agent  \\\n",
              "0                                                                                                                                                                        1   \n",
              "1  ['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']   \n",
              "\n",
              "  Agent Dialogue Act      Intent  \\\n",
              "0                  1           1   \n",
              "1            unknown  init-price   \n",
              "\n",
              "                                                                                                                                                                                               GAT_n_strategy_agent  \n",
              "0                                                                                                                                                                                                              ['']  \n",
              "1  ['first_person_singular_count_seller', '143', 'third_person_singular_seller', '164', 'number_of_diff_dic_pos', '184', 'number_of_diff_dic_neg', '19', 'personal_concern_seller', '169', 'liwc_certainty', '186']  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-5e900acc-81e6-4731-9425-9c0d9fae093e\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>User</th>\n",
              "      <th>Agent</th>\n",
              "      <th>Slot-Value</th>\n",
              "      <th>Value</th>\n",
              "      <th>Negotiation Strategy User</th>\n",
              "      <th>Negotiation Strategy Agent</th>\n",
              "      <th>Agent Dialogue Act</th>\n",
              "      <th>Intent</th>\n",
              "      <th>GAT_n_strategy_agent</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>['']</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>hi not sure if the charger would work for my car . can you sell it to me for 5 ?</td>\n",
              "      <td>it will work i have never seen a car without a cigarette lighter port .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']</td>\n",
              "      <td>['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']</td>\n",
              "      <td>unknown</td>\n",
              "      <td>init-price</td>\n",
              "      <td>['first_person_singular_count_seller', '143', 'third_person_singular_seller', '164', 'number_of_diff_dic_pos', '184', 'number_of_diff_dic_neg', '19', 'personal_concern_seller', '169', 'liwc_certainty', '186']</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-5e900acc-81e6-4731-9425-9c0d9fae093e')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-5e900acc-81e6-4731-9425-9c0d9fae093e button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-5e900acc-81e6-4731-9425-9c0d9fae093e');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 96
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "n_strategy_embed['Agent Dialogue Act'] = act_embed['Agent Dialogue Act']\n",
        "n_strategy_embed['GAT_act_agent'] = act_embed['GAT_act_agent']\n",
        "n_strategy_embed.head(2)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 401
        },
        "id": "dqd1wqjAy-ki",
        "outputId": "28a01737-5bbf-4f8f-e686-27a06949a783"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                                               User  \\\n",
              "0                                                                                 1   \n",
              "1  hi not sure if the charger would work for my car . can you sell it to me for 5 ?   \n",
              "\n",
              "                                                                     Agent  \\\n",
              "0                                                                        1   \n",
              "1  it will work i have never seen a car without a cigarette lighter port .   \n",
              "\n",
              "  Slot-Value Value  \\\n",
              "0          1     1   \n",
              "1        NaN   NaN   \n",
              "\n",
              "                                                                                                                                                              Negotiation Strategy User  \\\n",
              "0                                                                                                                                                                                     1   \n",
              "1  ['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']   \n",
              "\n",
              "                                                                                                                                                Negotiation Strategy Agent  \\\n",
              "0                                                                                                                                                                        1   \n",
              "1  ['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']   \n",
              "\n",
              "  Agent Dialogue Act      Intent  \\\n",
              "0                  1           1   \n",
              "1            unknown  init-price   \n",
              "\n",
              "                                                                                                                                                                                               GAT_n_strategy_agent  \\\n",
              "0                                                                                                                                                                                                              ['']   \n",
              "1  ['first_person_singular_count_seller', '143', 'third_person_singular_seller', '164', 'number_of_diff_dic_pos', '184', 'number_of_diff_dic_neg', '19', 'personal_concern_seller', '169', 'liwc_certainty', '186']   \n",
              "\n",
              "          GAT_act_agent  \n",
              "0                  ['']  \n",
              "1  ['unknown', '10641']  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-f398389c-045f-4c71-b71b-016615a54a82\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>User</th>\n",
              "      <th>Agent</th>\n",
              "      <th>Slot-Value</th>\n",
              "      <th>Value</th>\n",
              "      <th>Negotiation Strategy User</th>\n",
              "      <th>Negotiation Strategy Agent</th>\n",
              "      <th>Agent Dialogue Act</th>\n",
              "      <th>Intent</th>\n",
              "      <th>GAT_n_strategy_agent</th>\n",
              "      <th>GAT_act_agent</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>['']</td>\n",
              "      <td>['']</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>hi not sure if the charger would work for my car . can you sell it to me for 5 ?</td>\n",
              "      <td>it will work i have never seen a car without a cigarette lighter port .</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>['buyer_pos_sentiment', 'first_person_singular_count_buyer', 'third_person_singular_buyer', 'buyer_propose', 'hedge_count_buyer', 'assertive_count_buyer', 'politeness_buyer_greet']</td>\n",
              "      <td>['first_person_singular_count_seller', 'third_person_singular_seller', 'number_of_diff_dic_pos', 'number_of_diff_dic_neg', 'personal_concern_seller', 'liwc_certainty']</td>\n",
              "      <td>unknown</td>\n",
              "      <td>init-price</td>\n",
              "      <td>['first_person_singular_count_seller', '143', 'third_person_singular_seller', '164', 'number_of_diff_dic_pos', '184', 'number_of_diff_dic_neg', '19', 'personal_concern_seller', '169', 'liwc_certainty', '186']</td>\n",
              "      <td>['unknown', '10641']</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-f398389c-045f-4c71-b71b-016615a54a82')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-f398389c-045f-4c71-b71b-016615a54a82 button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-f398389c-045f-4c71-b71b-016615a54a82');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 97
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "n_strategy_embed.to_csv(\"CLB_GAT_int_both.csv\", index=False)"
      ],
      "metadata": {
        "id": "7MfGyFAvzcFL"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "m6JjOyxYzmR_"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}